package com.jy.event.domain;

import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.Date;

/**
 * 优惠券实例
 * <p>
 * Created by hanxi on 2017/11/16.
 */
@Entity
@Data
@NoArgsConstructor
public class CouponInstance {

    @Id
    @Column(length = 50)
    private String id;


    private String storeId;

    /**
     * 发卷人ID
     */
    private String creatorId;

    /**
     * 发卷人姓名
     */
    private String creatorName;

    /**
     * 优惠券实例编码
     */
    private String code;
    /**
     * 优惠券id
     */
    private String couponId;
    /**
     * 领取人id
     */
    private String ownerId;
    /**
     * 领取人open id
     */
    private String openId;
    /**
     * 起用时间
     */
    private Date beginTime;
    /**
     * 结束时间
     */
    private Date endTime;
    /**
     * 核销时间
     */
    private Date validateTime;

    /**
     * 状态
     */
    @Enumerated(EnumType.STRING)
    private CouponInstanceStatus stauts;
    /**
     * 关联优惠券代码，比如分享自优惠券xxx
     */
    private String refCouponCode;

    @Column(insertable = false, updatable = false, columnDefinition = "TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3)")
    private Date addTime;
    @Column(insertable = false, updatable = false, columnDefinition = "TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)")
    private Date updateTime;

}
